<template>
  <div>
    <Modal
      v-model="modals"
      width="700"
      scrollable
      closable
      :title="titleFrom"
      :mask-closable="false"
      :z-index="1"
      @on-cancel="handleReset"
	  @on-confirm="handleSubmit"
      @on-visible-change="visible"
    >
      <Form ref="formValidate" :model="formValidate" :label-width="110" :rules="ruleValidate" @submit.native.prevent>
        <div class="section">
			<div class="container">
				<div class="left">
					<div class="head"></div>
					<div class="body">
						<div class="text">
							眼睑：
						</div>
					</div>
					<div class="body">
						<div class="text">
							倒睫：
						</div>
					</div>
					<div class="body">
						<div class="text">
							眼睑闭合：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							泪器：
						</div>
					</div>
					<div class="body">
						<div class="text">
							泪点：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							结膜：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							角膜：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							前房：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							虹膜：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							瞳孔：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							晶体：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
					<div class="body">
						<div class="text">
							玻璃体：
						</div>
					</div>
					<div class="body">
						<div class="text">
							其他：
						</div>
					</div>
				</div>
				<div class="right">
					<div class="head">
						<div class="label">OD</div>
						<div class="label">OS</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.yj_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.yj_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.dj_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.dj_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.yjbh_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.yjbh_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.yj_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.lq_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.lq_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.ld_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.ld_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.ld_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.jm_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.jm_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.jm_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.jo_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.jo_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.jo_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.qf_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.qf_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.qf_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.hm_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.hm_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.hm_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.tk_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.tk_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.tk_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.jt_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.jt_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.jt_else" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.blt_od" placeholder="请输入"></Input>
						</div>
						<div class="text">
							<Input v-model="formValidate.blt_os" placeholder="请输入"></Input>
						</div>
					</div>
					<div class="body">
						<div class="text">
							<Input v-model="formValidate.blt_else" placeholder="请输入"></Input>
						</div>
					</div>
				</div><!-- right end -->
			</div><!--container end-->
		</div><!-- 远距视力 end-->
		
      </Form>
	  <div slot="footer">
	    <Button @click="cancel()">取消</Button>
	    <Button type="primary" @click="handleSubmit()">保存</Button>
	  </div>
    </Modal>
  </div>
</template>

<script>
import { saveApi} from '@/api/slitlamp';
import icon from '@/utils/icon';
import { getCookies } from '@/libs/util';
export default {
  name: 'lampFrom',
  props: {
    formValidate: {
      type: Object,
      default: null,
    },
    titleFrom: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      arrs: [],
      searchRule: '',
      iconVal: '',
      grid: {
        xl: 12,
        lg: 12,
        md: 12,
        sm: 24,
        xs: 24,
      },
      modals: false,
      ruleValidate: {
		
      },
      types: [],
      status: [],
      citys: [],
      companys: [],
      users: [],
      valids: false,
      list: icon,
      authType: true,
      search: icon,
	  header: {},
      fileUrl: '/adminapi/file/upload_file/1',
	  files:[]
    };
  },
  watch: {
    'formValidate.header': function (n) {
      this.formValidate.is_header = n ? 1 : 0;
    },
    'formValidate.auth_type': function (n) {
      if (n === undefined) {
        n = 1;
      }
      this.authType = n === 1;
    },
    'formValidate.data': function (n) {},
  },
  computed: {
	  
  },
  methods: {
    init() {
      this.searchRule = '';
      this.arrs = [];
    },
	// 上传成功
	handleSuccess(res, file) {
	  if (res.status === 200) {
		this.files.push(res.data.data);
	    this.$Message.success(res.msg);
	  } else {
	    this.$Message.error(res.msg);
	  }
	},
	handleFormatError(file) {
		
	},
	handleMaxSize(file) {
	  this.$Message.warning('请上传文件30M以内的文件');
	},
	delFile(index){
		this.files.splice(index,1);
	},
	// 上传头部token
	getToken() {
	  this.header['Authori-zation'] = 'Bearer ' + getCookies('token');
	  console.info(this.header);
	},
    handleCreate1(val) {
      this.headerOptionsList.push({
        value: val,
        label: val,
      });
    },
    // 获取客户数据
    getAddFrom() {
		let that = this;
   //      ListCateApi()
   //      .then(async (res) => {
			// that.types = res.data['CONTRACT_TYPE'];
			// that.status = res.data['CONTRACT_STATUS'];
			// that.users = res.data['users'];
			// that.companys = res.data['companys'];
			// that.citys = res.data['citys'];
   //      })
   //      .catch((res) => {
   //        this.$Message.error(res.msg);
   //      });
    },
	cancel(){
		this.modals = false;
	},
    // 提交
    handleSubmit() {
      this.$refs['formValidate'].validate((valid) => {
        if (valid) {
          this.valids = true;
		  console.info(this.formValidate);
          saveApi(this.formValidate)
            .then(async (res) => {
              this.$Message.success(res.msg);
              this.modals = false;
              this.$emit('getList');
            })
            .catch((res) => {
              this.$Message.error(res.msg);
            });
        } else {
			
        }
      });
    },
    handleReset() {
      this.modals = false;
      this.authType = true;
      this.$refs['formValidate'].resetFields();
      this.$emit('clearFrom');
    },
  },
  created() {
    this.list = this.search;
    this.getToken();
    this.getAddFrom();
  },
};
</script>

<style scoped>
.trees-coadd {
  width: 100%;
  height: 500px;
  border-radius: 4px;
  overflow: hidden;
}
.scollhide {
  width: 100%;
  height: 100%;
  overflow: auto;
  margin-left: 18px;
  padding: 10px 0 10px 0;
  box-sizing: border-box;
}
.content {
  font-size: 12px;
}

.time {
  font-size: 12px;
  color: #2d8cf0;
}

.icons-item {
  float: left;
  margin: 6px 6px 6px 0;
  width: 53px;
  text-align: center;
  list-style: none;
  cursor: pointer;
  height: 50px;
  color: #5c6b77;
  transition: all 0.2s ease;
  position: relative;
  padding-top: 10px;
}
.icons-item .ivu-icon {
  font-size: 16px;
}
.search-rule {
  display: flex;
  align-items: center;
  padding: 10px;
  background-color: #f2f2f2;
}
.rule {
  display: flex;
  flex-wrap: wrap;
  max-height: 700px;
  overflow: scroll;
}
/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/
.rule::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background-color: #f5f5f5;
}

/*定义滚动条轨道 内阴影+圆角*/
.rule::-webkit-scrollbar-track {
  border-radius: 4px;
  background-color: #f5f5f5;
}

/*定义滑块 内阴影+圆角*/
.rule::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background-color: #555;
}
.rule-list {
  background-color: #f2f2f2;
  width: 32%;
  margin: 5px;
  border-radius: 3px;
  padding: 10px;
  color: #333;
  cursor: pointer;
  transition: all 0.1s;
}
.rule-list:hover {
  background-color: #c5d1dd;
}
.rule-list div {
  white-space: nowrap;
}
.select-rule {
  background-color: #c5d1dd;
}
.add {
  display: flex;
  align-items: center;
}
.df {
  display: flex;
  justify-content: center;
}

.file{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
}

.file:hover{
	background-color: #edf7fe;
}
.close-bg{
	display: inline-block;
	width: 35px;
	height: 35px;
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
	margin-right: 15px;;
}

.close-bg:hover{
	cursor: pointer;
}

.close {
	display: inline-block;
	width: 15px;
	height: 2px;
	background: red;
	transform: rotate(45deg);
}

.close::after {
	content: '';
	display: block;
	width: 15px;
	height: 2px;
	background: red;
	transform: rotate(-90deg);
}

/*** 布局 ***/
.section{
	display: flex;
	flex-direction: column;
	padding: 0px 15px 30px 15px;
}
.section .header{
	font-size: 16px;
	font-weight: bold;
	padding: 0px 0px 10px 0px;
	border-bottom: 1px solid #f1f1f1;
}
.section .container{
	display: flex;
	flex-direction: row;
	margin-top: 20px;
}
.section .container .left{
	display: flex;
	flex-direction: column;
	width: 80px;
}
.section .container .left .head{
	display: flex;
	flex-direction: row;
	height: 30px;
	align-items: center;
}
.section .container .left .body{
	display: flex;
	flex-direction: row;
	height: 30px;
	align-items: center;
	margin: 5px 0px;
}
.section .container .left .body .text{
}
.section .container .right{
	display: flex;
	flex-direction: column;
	flex: 1;
}
.section .container .right .head{
	display: flex;
	flex-direction: row;
	height: 30px;
	align-items: center;
}
.section .container .right .head .label{
	flex:1;
	text-align: center;
}
.section .container .right .body{
	display: flex;
	flex-direction: row;
	height: 30px;
	align-items: center;
	margin: 5px 0px;
}
.section .container .right .body .text{
	height:32px;
	flex:1;
	padding: 0px 15px;
	display: flex;
	flex-direction: row;
	align-items: center;
}
</style>
